﻿using System;
using System.Diagnostics;
using System.Xml.Serialization;

namespace PrearrangedChaos.AgileZen.Service.Model
{
    /// <remarks/>
    [DebuggerStepThrough()]
    [XmlType(AnonymousType = true)]
    [XmlRootAttribute(ElementName = "milestone", Namespace = "", IsNullable = false)]
    public partial class Milestone : IMilestone
    {
        private TimeSpan _duration;
        private IPhase _phase;

        /// <remarks/>
        [XmlElement(ElementName = "duration")]
        public int DurationXmlElement
        {
            get { return (int)this.Duration.TotalSeconds;  }
            set { this._duration = TimeSpan.FromSeconds(value); }
        }

        [XmlElement]
        public TimeSpan Duration
        {
            get { return _duration; }
            set { _duration = value; }
        }

        /// <remarks/>
        [XmlElement(ElementName = "id")]
        public int Id { get; set; }

        /// <remarks/>
        [XmlElement(ElementName = "startTime")]
        public DateTime StartTime { get; set; }

        /// <remarks/>
        [XmlElement(ElementName = "phase")]
        public Phase PhaseXmlElement
        {
            get { return _phase as Phase; }
            set { _phase = value; }
        }

        /// <remarks/>
        [XmlIgnore]
        public IPhase Phase
        {
            get { return _phase; }
            set { _phase = value; }
        }
    }
}